  <style>
 .help-block{color:red!important;}
 </style>
 <div class="pageheader">
      <h2><i class="fa fa-home"></i> Exam Add </h2>
    </div>
    
    <div class="contentpanel">
       
      <div class="panel panel-default">
        <div class="panel-heading">
          <h4 class="panel-title"><strong>Add new Board, Class and Subject</strong></h4>		
        </div>
		 <form action="<?php echo site_url("teacher").'/'.$this->uri->segment(2); ?>/add_new_exam" method="post" class="form-horizontal">
        <div class="panel-body panel-body">
			<div class="row">
			  <?php if($this->session->flashdata('message_board_added') !== false && $this->session->flashdata('message_board_added') == 1){
			?> <div class="alert alert-success fade in">
				<a href="#" class="close" data-dismiss="alert">&times;</a>
				<strong>Success!</strong> Data Submitted successfully.
			</div>
				<?php
			  } ?>
			  <?php if($this->session->flashdata('message_board_added') !== false && $this->session->flashdata('message_board_added') == 0){
			?> <div class="alert alert-warning fade in">
				<a href="#" class="close" data-dismiss="alert">&times;</a>
				<strong>Warning!</strong> No Data Added.
			</div>
				<?php
			  } ?>
			  <div class="form-group col-md-12">
							<div class="col-md-3">
								<label for="course_board">Board<strong style="color:red">*</strong> : </label>
							</div>
								<div class="col-md-7">	
									 <?php $boards = $this->db->get_where('tbl_courses',array('type'=>'board'))->result_array(); ?>
									<select name="course_board" class="form-control select2" disabled>
									  <option value="">Choose a Board...</option>
									  <?php foreach($boards as $board){ ?>
									  <option value="<?php echo $board['id'];?>" <?php if($board['id'] == $this->db->get_where("users",array("user_id"=>$this->session->userdata("user_data")["user_id"]))->row()->course){echo "selected";}?>><?php echo $board['name'];?></option>
									  <?php } ?>
									</select>
									<input type="hidden" name="course_board" value="<?php echo $this->db->get_where("users",array("user_id"=>$this->session->userdata("user_data")["user_id"]))->row()->course; ?>">
								</div>
						</div>
						<div class="form-group col-md-12">
							<div class="col-md-3">
								<label for="course_class">Class<strong style="color:red">*</strong> :</label>
							</div>
							<div class="col-md-7">
									<?php $classes = $this->db->get_where('tbl_courses',array('type'=>'class'))->result_array(); ?>
										<select name="course_class" class="form-control select2">
										  <option value="">Choose a Class...</option>
										   <?php foreach($classes as $class){ ?>
												<option value="<?php echo $class['id'];?>"><?php echo $class['name'];?></option>
										  <?php } ?>
										</select>
									</div>
						</div>
						<div class="form-group col-md-12">
							<div class="col-md-3">
								<label for="course_subject">Subject<strong style="color:red">*</strong> :</label>
							</div>
							<div class="col-md-7">
									<?php $classes = $this->db->get_where('tbl_courses',array('type'=>'subject'))->result_array(); ?>
										<select name="course_subject" class="form-control select2">
										  <option value="">Choose a Subject...</option>
										   <?php foreach($classes as $class){ ?>
												<option value="<?php echo $class['id'];?>"><?php echo $class['name'];?></option>
										  <?php } ?>
										</select>
									</div>
						</div>
							
						<div class="form-group col-md-12">
							<div class="col-md-3">
								<label for="exam_title">Title Of Exam<strong style="color:red">*</strong> : </label>
							</div>
							<div class="col-md-7">
									<input type="text" placeholder="Title of Exam..." name="exam_title" class="form-control" />
								</div>
						</div>
							
							
						<div class="form-group col-md-12">
						
							<div class="col-md-3">
								<label for="description">Description<strong style="color:red">*</strong> : </label>
							</div>
							<div class="col-md-7">
									<textarea name="description" placeholder="Description of Exam..." class="form-control"></textarea>
								</div>
						</div>
				
            
           </div>
			 		
			
        </div><!-- panel-body -->
        
        <div class="panel-footer">
			<div class="row">
				<div class="col-sm-6 col-sm-offset-3">
				  <button type="submit" class="btn btn-success">Submit</button>&nbsp;
				  <button class="btn btn-default">Cancel</button>
				</div>
			</div>
		</div><!-- panel-footer -->
          
	  	</form>
      </div><!-- panel -->
        
    </div><!-- contentpanel -->
    
  </div><!-- mainpanel -->
 
  
</section>


<script src="<?php echo base_url();?>adm/js/jquery-1.10.2.min.js"></script>
<script src="<?php echo base_url();?>adm/js/jquery-migrate-1.2.1.min.js"></script>
<script src="<?php echo base_url();?>adm/js/bootstrap.min.js"></script>
<script src="<?php echo base_url();?>adm/js/modernizr.min.js"></script>
<script src="<?php echo base_url();?>adm/js/jquery.sparkline.min.js"></script>
<script src="<?php echo base_url();?>adm/js/toggles.min.js"></script>
<script src="<?php echo base_url();?>adm/js/jquery.cookie.js"></script>
<script src="<?php echo base_url();?>adm/js/jquery.datatables.min.js"></script>
<script src="<?php echo base_url();?>adm/js/select2.min.js"></script>
<script src="<?php echo base_url();?>adm/js/bootstrapValidator.js"></script>
<script src="<?php echo base_url();?>adm/js/custom.js"></script>
<script>
  jQuery(document).ready(function() {
    
    jQuery('#table1').dataTable();
    
    jQuery('#table2').dataTable({
      "sPaginationType": "full_numbers"
    });
    
    // Chosen Select
    jQuery("select").select2();
    
    // Delete row in a table
    jQuery('.delete-row').click(function(){
      var c = confirm("Continue delete?");
      if(c)
        jQuery(this).closest('tr').fadeOut(function(){
          jQuery(this).remove();
        });
        
        return false;
    });
    
    // Show aciton upon row hover
    jQuery('.table-hidaction tbody tr').hover(function(){
      jQuery(this).find('.table-action-hide a').animate({opacity: 1});
    },function(){
      jQuery(this).find('.table-action-hide a').animate({opacity: 0});
    });
   jQuery('.form-horizontal').bootstrapValidator({
			message: 'This value is not valid',
			feedbackIcons: {
				valid: 'glyphicon glyphicon-ok',
				invalid: 'glyphicon glyphicon-remove',
				validating: 'glyphicon glyphicon-refresh'
			},
			fields: {
				 'course_board':{
						 validators: {					
						 notEmpty: {
							message: 'The Board is required and cannot be empty'
						 }}},
						 'course_class':{
						 validators: {					
						 notEmpty: {
							message: 'The Class is required and cannot be empty'
						 }}},
						'course_subject':{validators: {					
						 notEmpty: {
							message: 'The Subject is required and cannot be empty'
						}
						}},
						'description':{validators: {					
						 notEmpty: {
							message: 'The Description Of Exam is required and cannot be empty'
						}
						}},
						'exam_title':{validators: {					
						 notEmpty: {
							message: 'The Title Of Exam is required and cannot be empty'
						}
						}}
			}
	  });
  
  });
</script>

</body>
</html>
